
/**
 * Camera
 * @version 1.0
 * @since 1.0
 * <p>
 * Created by Murphy at 2021/7/9 17:06
 **/
#include "Camera.hpp"

namespace Stitches
{


Ray Stitches::Camera::getRay(double u, double v) const
{
    Vec3f rd = mLensRadius * random_in_unit_disk();
    Vec3f offset((float)u * rd.x + (float)v * rd.y);

    return Ray(mOrigin + offset, mLowerLeftCorner + (float)u * mHorizontal + (float)v * mVertical - mOrigin - offset);
}

}